<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        var str = 'hello';
        var str1 = '100';
        var str2 = 'hi100';
        var str3 = '';
        var str4 = '   ';

        var a;
        var obj = null;
        var flag = true;


        // 方法: Number()
        console.log('true===>',Number(true));   //1
        console.log('false===>',Number(false));  //0
        
    </script>
</body>
</html>